package com.com.typhoon.dao;

import com.com.typhoon.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author shuya | dongfeng.zdf@alibaba-inc.com
 * @description
 * @date 2019/1/3 下午4:43
 * @description
 * @modified by
 * @since V2.0.0
 */
@Repository
public class UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<User> listAll() {
        String sql = "select * from \"public\".\"user\"";
        return  jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(User.class));
    }

}
